package Pre.Set;

import java.util.HashMap;

public class Rank {
    private int order;
    private int star;

    public Rank(int order, int star) {
        this.order = order;
        this.star = star;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public int getStar() {
        return star;
    }

    public void setStar(int star) {
        this.star = star;
    }

    @Override
    public String toString() {
        return "Rank{" +
                "order=" + order +
                ", star=" + star +
                '}';
    }
}


class Test1{
    public static void main(String[] args) {
        HashMap<TVPlay, Rank> hashMap = new HashMap<>();
        hashMap.put(new TVPlay("甄嬛传", 74), new Rank(2, 4));
        hashMap.put(new TVPlay("长风渡", 40), new Rank(4, 1));
        hashMap.put(new TVPlay("莲花楼", 40), new Rank(1, 5));
        hashMap.put(new TVPlay("长相思", 40), new Rank(3, 2));
        System.out.println(hashMap.put(new TVPlay("长相思", 40), null));
        System.out.println(hashMap);
        // 返回原来key对应的value 如果key没有映射返回null
        Rank rank = hashMap.remove(new TVPlay("长相思",40));
        System.out.println(rank);
        System.out.println(hashMap.keySet().size());
        System.out.println(hashMap.size());
        System.out.println(hashMap.values());

    }
}
